<template>
    <div class="privilege">
        <h2>优惠码支付</h2>
        <div class="code">
            <input placeholder="在此输入优惠码" class="coding_text">
            <div class="confirm" @click="code">确定</div>
            <div class="clear"></div>
        </div>
        <!--<p>参与内测用户可使用优惠码支付获得完整报告码</p>-->
        <img class="logo" src="static/images/logo.png" alt="">
    </div>
</template>

<script>
    export default {
        name: 'privilege',
        data () {
            return {
                an_id : 0,
                coding: 0,
            }
        },
        mounted () {
        },
        components : {

        },
        methods : {
            code (e) {
                var code = $('.coding_text').val()
                var an_id = sessionStorage.getItem("an_id")
                if( code == '' )
                {
                    alert('请先填写优惠码')
                    return false;
                }
                //查看优惠码是否正确
                var url = this._API_ + "privilege?code=" + code + "&an_id=" + an_id
                this.$http.get(url).then(e => {
                    if( e.data )
                    {
                        // location.href = "/#/Coding"
                        this.$router.push({name: 'Coding'})
                        // location.href = location.href
                    }
                    else
                    {
                        alert('优惠码错误，请重新填写')
                    }
                })

            }
        }

    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    h2{
        font-size:3.6rem;
        color:#f05c78;
        text-align: center;
        line-height:200px;
    }
    .coding_text{
        width:415px;
        border:1px solid #f05c78;
        height:66px;
        text-align: left;
        color:#393939;
        text-indent: 20px;
        line-height:66px;
        font-size:2.6rem;
        margin:0px auto;
        -webkit-user-select: text;
        user-select: text;
        float: left;
        border-radius:0px;
    }
    .code{
        width:555px;
        margin:0px auto;
    }
    .confirm{
        font-size:2.6rem;
        color:#f05c78;
        line-height: 66px;
        height:66px;
        text-align: center;
        width:135px;
        float:left;
        border:1px solid #f05c78;
        border-left:0px;
    }
    .clear{
        clear:both;
    }
    p{
        font-size:2.6rem;
        width:555px;
        margin:0px auto;
        line-height: 4rem;
        text-align: center;
        color:#393939;
    }
    .logo{
        position: absolute;
        left:269.5px;
        bottom:85px;
    }
</style>
